package com.cml.rpc.loadbalance;

import java.util.List;
import java.util.Random;

/**
 * @author cml
 * @create 2021/7/22 12:53
 */
public class RandomLoadBalance implements LoadBalance{
    @Override
    public String loadBalance(List<String> addressList) {
        Random random = new Random();
        int index = random.nextInt(addressList.size());
        System.out.println("随机负载均衡：" + addressList.get(index) + "服务器");

        return addressList.get(index);
    }
}
